package beautiful.butterfly.drds.binlog.connection;


import lombok.extern.slf4j.Slf4j;

import java.util.regex.Pattern;

@Slf4j
public class DatabaseNameAndTableNameFilter
{

    private Pattern databaseNamePattern;
    private Pattern tableNamePattern;

    public DatabaseNameAndTableNameFilter(Pattern databaseNamePattern, Pattern tableNamePattern)
    {
        this.databaseNamePattern = databaseNamePattern;
        this.tableNamePattern = tableNamePattern;
    }

    public boolean accept(String databaseName, String tableName)
    {
        return databaseNamePattern.matcher(databaseName).matches() && tableNamePattern.matcher(tableName).matches();
    }

}